<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{:$i->title}</title>
<link href="{:$smarty.const.PUBLIC_DIR}/common/style/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrapper">
  <div class="title shadow titleBg">
    <table width="100%" border="0" cellspacing="1">
      <tr>
        <td><h1> {:$i->title} <span>[<a href="{:$smarty.const.BOOT_URL}/{:$i->c}/revert">还原</a>]</span></h1></td>
      </tr>
    </table>
  </div> 
  <div class="content shadow">
  <form action="{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/backup" method="post" />
    <table width="100%" border="0" cellspacing="1">
      <tr class="titleBg">
        <th scope="col">选择</th>
        <th scope="col" class="textL">表名(记录数)</th>
        <th scope="col">操作</th>
        <th scope="col">选择</th>
        <th scope="col" class="textL">表名(记录数)</th>
        <th scope="col">操作</th>
      </tr>
      {:foreach item=item from=$i->tables}<tr>
        <td class="left"><input name="selected[]" {:$item.left.checked} type="checkbox" value="{:$item.left.name}" class="noBorder" /></td>
        <td class="left" style="text-align:left;">{:$item.left.name}({:$item.left.count})</td>
        <td class="left">
            <a href="#@" onClick="getDialog('{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/optimize/{:$item.left.name}');">优化</a> | 
            <a href="#@" onClick="getDialog('{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/repair/{:$item.left.name}');">修复</a> | 
            <a href="#@" onClick="getDialog('{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/showCreate/{:$item.left.name}','top');">结构</a>
    	</td>
        {:if $item.right.name != ''}
        <td class="right"><input name="selected[]" {:$item.right.checked} type="checkbox" value="{:$item.right.name}" class="noBorder" /></td>
        <td class="right" style="text-align:left;">{:$item.right.name}({:$item.right.count})</td>
        <td class="right">
            <a href="#@" onClick="getDialog('{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/optimize/{:$item.right.name}');">优化</a> | 
            <a href="#@" onClick="getDialog('{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/repair/{:$item.right.name}');">修复</a> | 
            <a href="#@" onClick="getDialog('{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/showCreate/{:$item.right.name}','top');">结构</a> 
    	</td>
        {:else}
        <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
        {:/if}
      </tr>{:/foreach}       
      <tr>
        <td colspan="6" class="lightGreyBg textL"> <a href="#@" onclick="return selAll('selected[]');">全选</a> | <a href="#@" onclick="return selAnti('selected[]');">反选</a> | <a href="#@" id="submit" onclick="if(confirm('确定要开始备份所选数据？'))document.forms[0].submit();else return false;">开始备份</a></td>
      </tr>
    </table>
    </form>
  </div>
</div>
<link href="{:$smarty.const.PUBLIC_DIR}/common/style/ui.all.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.core.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.draggable.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.resizable.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.dialog.js"></script>
<script language="javascript" type="text/javascript">
function getDialog(url, position)
{
	if(url == undefined) { url = ''; }
	if(position == undefined) { position = 'center'; }
	
	if($('.ui-dialog').length > 0)
	{
		$('.ui-dialog').remove();
	}
	
	$('<div class="ui-dialog-message" style="text-align:left;"><span class="ui-dialog-loading">&nbsp;</span>正在处理,请稍候...</div>').dialog({
		title:'提示信息',
		resizable : true,
		width : "auto",
		position : position
	});
	
	if(url != '')
	{
		$.ajax({
			type : 'get',
			dataType : 'json',
			url : url,
			success : function(response) 
			{
				$(".ui-dialog-message").html(response.message);
			}
		});	
	}
}

function selAll(name)
{
	$("input[name='"+name+"']").attr("checked", true);
	return false;
}

function selAnti(name)
{
	$("input[name='"+name+"']").each(function(i){
		this.checked=!this.checked;
	});
	
	return false;
}

$(document).ready(function(){
	$(".content table .left,.content table .right")
		.mouseover(function(){
			if($(this).attr('class') == 'left' || $(this).attr('class') == 'left selected')
			{
				$(this).parent().find(".left").removeClass("selected");
				$(this).parent().find(".left").addClass("titleBg");
			}
			else if($(this).attr('class') == 'right' || $(this).attr('class') == 'right selected')
			{
				$(this).parent().find(".right").removeClass("selected");
				$(this).parent().find(".right").addClass("titleBg");
			}
		})
		.mouseout(function(){
			if($(this).attr('class') == 'left titleBg')
			{
				$(this).parent().find(".left").removeClass("titleBg");
			}
			else if($(this).attr('class') == 'right titleBg')
			{
				$(this).parent().find(".right").removeClass("titleBg");
			}
		})
});
</script>
</body>
</html>
